package com.xoomworks.rsfr.model;

import java.io.Serializable;
import java.util.Date;

/**
 * The persistent class for the TrustedCompanies database table.
 * @author bogdan.pop
 */
public class TrustedCompany extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    private Date createdOn;

    private Date modifiedOn;

    // uni-directional many-to-one association to User
    private User createdBy;

    // uni-directional many-to-one association to User
    private User modifiedBy;

    // bi-directional many-to-one association to Company
    private Company firstCompany;

    // bi-directional many-to-one association to Company
    private Company secondCompany;

    // uni-directional many-to-one association to Trustedcompanystate
    private TrustedCompanyState trustedCompanyState;


    /**
     * Constructor with no fields.
     */
    public TrustedCompany() {
    }

    /**
     * Constructor with specified parameters.
     * @param createdOn Date Represents the date when the trusted company session  was created.
     * @param createdBy User Represents the user who created the trusted company.
     * @param firstCompany Company.
     * @param secondCompany Company.
     * @param trustedCompanyState TrustedCompanyState.
     */
    public TrustedCompany(final Date createdOn, final User createdBy, final Company firstCompany,
            final Company secondCompany, final TrustedCompanyState trustedCompanyState) {
        super();
        this.createdOn = createdOn;
        this.createdBy = createdBy;
        this.firstCompany = firstCompany;
        this.secondCompany = secondCompany;
        this.trustedCompanyState = trustedCompanyState;
    }

    /**
     * Gets the date when the trusted company session was created.
     * @return createdOn Date Represents the date when the trusted company session was created.
     */
    public Date getCreatedOn() {
        return this.createdOn;
    }

    /**
     * Sets the date when the trusted company session was created.
     * @param createdOn Date Which is used to set createdOn.
     */
    public void setCreatedOn(final Date createdOn) {
        this.createdOn = createdOn;
    }

    /**
     * Gets the date when the trusted company session was modified.
     * @return modifiedOn Date Represents the date when the trusted company session was modified.
     */
    public Date getModifiedOn() {
        return this.modifiedOn;
    }

    /**
     * Sets the date when the trusted company session was modified.
     * @param modifiedOn Date Which is used to set modifiedOn.
     */
    public void setModifiedOn(final Date modifiedOn) {
        this.modifiedOn = modifiedOn;
    }

    /**
     * Gets the user who created the trusted company.
     * @return createdBy User Represents the user who created the trusted company.
     */
    public User getCreatedBy() {
        return this.createdBy;
    }

    /**
     * Sets the user who created the trusted company.
     * @param createdBy User Which is used to set createdBy.
     */
    public void setCreatedBy(final User createdBy) {
        this.createdBy = createdBy;
    }

    /**
     * Gets the user who modified the trusted company.
     * @return modifiedBy User Represents the user who created the trusted company.
     */
    public User getModifiedBy() {
        return this.modifiedBy;
    }

    /**
     * Sets the user who created the trusted company.
     * @param modifiedBy User Which is used to set modifiedBy.
     */
    public void setModifiedBy(final User modifiedBy) {
        this.modifiedBy = modifiedBy;
    }

    /**
     * Gets the first company.
     * @return firstCompany
     */
    public Company getFirstCompany() {
        return this.firstCompany;
    }

    /**
     * Sets the first Company.
     * @param firstCompany Company Which is used to set firstCompany.
     */
    public void setFirstCompany(final Company firstCompany) {
        this.firstCompany = firstCompany;
    }

    /**
     * Gets the second company.
     * @return secondCompany
     */
    public Company getSecondCompany() {
        return this.secondCompany;
    }

    /**
     * Sets the second comapny.
     * @param secondCompany Company Which is used to set secondCompany.
     */
    public void setSecondCompany(final Company secondCompany) {
        this.secondCompany = secondCompany;
    }

    /**
     * Gets the trusted company state.
     * @return trustedCompanyState TrustedCompanyState Represents the trusted company state.
     */
    public TrustedCompanyState getTrustedCompanyState() {
        return this.trustedCompanyState;
    }

    /**
     * Sets the trusted company state.
     * @param trustedCompanyState TrustedCompanyState Which is used to set trustedCompanyState.
     */
    public void setTrustedCompanyState(final TrustedCompanyState trustedCompanyState) {
        this.trustedCompanyState = trustedCompanyState;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = (prime * result)
                + ((secondCompany == null) ? 0 : secondCompany.hashCode());
        result = (prime
                * result)
                + ((trustedCompanyState == null) ? 0 : trustedCompanyState
                        .hashCode());
        return result;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        TrustedCompany other = (TrustedCompany) obj;
        if (secondCompany == null) {
            if (other.secondCompany != null) {
                return false;
            }
        } else if (!secondCompany.equals(other.secondCompany)) {
            return false;
        }
        if (trustedCompanyState == null) {
            if (other.trustedCompanyState != null) {
                return false;
            }
        } else if (!trustedCompanyState.equals(other.trustedCompanyState)) {
            return false;
        }
        return true;
    }

}
